package com.sqk.dxpro.dxtop;

import java.io.IOException;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Mapper.Context;

import com.sqk.dxpro.utils.TProperties;
public class DxTopMapper extends Mapper<LongWritable, Text, Text, Text> {

	public void map(LongWritable key, Text value,Mapper<LongWritable, Text, Text, Text>.Context context) 
			throws IOException, InterruptedException {
		
		String topkey=context.getConfiguration().get("topkey");//读入数据的第二列
		
		
		String[] values = value.toString().split(TProperties.getValue("fileoutsplit"));
		Text k = new Text(values[Integer.parseInt(topkey)]);
		context.write(k, value);//按照用户进行分组
	}
}
